﻿namespace Baggr.ClientSite.Models
{
    using System.Collections.Generic;
    using System.Linq;
    using System.Web.Mvc;

    public static class FeedItemsSortingHelper
    {
        private static SelectListItem ToSelectListItem(FeedItemsSorting filter, bool selected)
        {
            return new SelectListItem()
                       {
                           Selected = selected,
                           Text = filter.Text,
                           Value = filter.AsString
                       };
        }
        public static IEnumerable<SelectListItem> ToSelectListItems(this FeedItemsSorting selected)
        {
            return FeedItemsSorting.All
                .Select(curr => ToSelectListItem(curr, curr == selected));
        }
    }
}
